<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<%@ include file="/resources/modular/plugin/taglibs.jsp" %>
<!doctype html>
<head content="-设备">
    <%@ include file="/resources/modular/head/inside_factory_head.jsp" %>
</head>
<style type="text/css">
    .equipment_typeMore, .equipment_parameterMore,
    .equipment_parMoreul, .pointpage_psddv,
    .pointpage_point{
        display:none;
    }
</style>
<body class="GC_Menu_4"  name="GC_device">
<%@ include file="/resources/modular/plugin/mainFactoryMenu.jsp" %>
<div class="page">
    <%@ include file="/resources/modular/plugin/mainFactoryTopMenu.jsp" %>
    <%@ include file="/WEB-INF/jsp/web/v2/device/factory/_left.jsp" %>
    <c:choose>
        <c:when test="${view==1}">
            <%@ include file="/WEB-INF/jsp/web/v2/device/factory/_right1.jsp" %>
        </c:when>
        <c:when test="${view==2}">
            <%@ include file="/WEB-INF/jsp/web/v2/device/factory/_right2.jsp" %>
        </c:when>
        <c:when test="${view==3}">
            <%@ include file="/WEB-INF/jsp/web/v2/param/factory/_right1.jsp" %>
        </c:when>
        <c:when test="${view==4}">
            <%@ include file="/WEB-INF/jsp/web/v2/param/factory/_right2.jsp" %>
        </c:when>
        <c:when test="${view==5}">
            <%@ include file="/WEB-INF/jsp/web/v2/device/factory/_right3.jsp" %>
        </c:when>
        <c:otherwise>
            <%@ include file="/WEB-INF/jsp/web/v2/device/factory/_right1.jsp" %>
        </c:otherwise>
    </c:choose>

    <!-- 新增类型参数 提示弹窗 -->
    <div class="pointpage_psddv">
        <div class="pointpage_psd">
            <p class="pointpage_psdtitle">
                <strong class="pointpage_psdtitleName">新增类型</strong>
                <a href="javascript:;" class="pointpage_psdclose"></a>
            </p>
            <p class="pointpage_psdval">
                <span>类型名称：</span>
                <input class="pointpage_value" type="text" placeholder="请输入类型名称">
                <a class="pointpage_cfm" href="javascript:;">确认</a>
            </p>
            <p class="pointpage_point">请输入1-6位字符</p>
        </div>
    </div>
    <!-- 新增类型参数 提示弹窗 end -->



</div>
</body>
</html>
<%@ include file="/resources/modular/foot/inside_factory_footer.jsp" %>
<script type="application/javascript">
    $(".pointpage_cfm").on("click", function(){
        var pointpage_value=$(this).parents(".pointpage_psdval").find(".pointpage_value").val();
        if(regName.test(pointpage_value)){
            $(".pointpage_psddv").stop().hide();
            addDeviceType(pointpage_value);
        }else{
            $(this).parents(".pointpage_psd").find(".pointpage_point").stop().show();
        }
    });

    function addDeviceType(typeName) {
        $.ajax({
            url: uri+"addDeviceType",
            type: 'POST',
            data: {"typeName":typeName},
            error: function (response) {
                $errorMsg(response);
            },
            success: function (ret) {
                if(ret.result==true){
                    $(".equipment_typeMore").append("<li><a href='javascript:;' name='"+ret.deviceTypeId+"' >"+typeName+"</a></li>");
                    $(".equipment_parameterMore").append("<li><a class='equipment_parMorebtn' name='"+ret.deviceTypeId+"' href='javascript:;'>"+typeName+"</a><ul class='equipment_parMoreul'></ul></li>");
                    equipment_parameterSecond();
                    $(".pointpage_value").val("");
                }else{
                    alert(ret.info);
                }
            }
        });
    }
    /*//增加参数组  确认
    $(".equipment_parameter_cfm").on("click", function(){
        var equipment_parameter_addval =$(this).parents(".pointpage_psdval").find(".pointpage_value").val();
        var equipmentType=$(this).parents(".page").find(".page_right").find(".equipment_rightp").children("span").text();
        if(regName.test(equipment_parameter_addval)){
            var typeName = '${deviceParamType}';
            $.ajax({
                url: "${basePath}v2/factory/param/addParamGroup",
                type: 'POST',
                data: {"typeName":typeName,"groupName":equipment_parameter_addval},
                error: function (response) {
                    $errorMsg(response);
                },
                success: function (ret) {
                    if(ret.result==true){
                        alert("参数组添加成功", "cur");

                        $(".page").find(".equipment_parameterMore").find(":contains("+equipmentType+")").next("ul").append("<li><a href='javascript:;' name='"+ret.groupId+"'>"+equipment_parameter_addval+"</a></li>");

                        $(".pointpage_dv2").stop().hide();

                        equipment_parameterThird();
                    }else{
                        alert(ret.info);
                    }
                }
            });
        }
    });*/

</script>